home *** CD-ROM | disk | FTP | other *** search
- Path: jaring.my!usenet
- From: yinchau@pl.jaring.my (Choong Yin Chau)
- Newsgroups: comp.lang.c++
- Subject: [Help!] "Declaration syntax error" on interrupt program ?
- Date: Sun, 25 Feb 1996 16:07:22 GMT
- Organization: Unconfigured
- Message-ID: <4gq1mk$8bl@jaring.my>
- NNTP-Posting-Host: j3.glg51.jaring.my
- X-Newsreader: Forte Free Agent v0.55
-
- Below is an example program from the Turbo C++ 3.0 Online Help.
- However when I run the program, an error message appeared at line
- "#####" stating that there is some "declaration syntax error" that I
- failed to find out.
-
- Can anyone help me with my first involvement in "interrupts". TQ.
-
- ___________________________________________________
-
- #include <dos.h>
- #include <conio.h>
-
- void interrupt (*mybeep)( void )
- { #####
- int i, j;
- char originalbits, bits;
- unsigned char bcount = _AX >> 8;
-
- /* Get the current control port setting */
- bits = originalbits = inportb(0x61);
-
- for (i = 0; i <= bcount; i++)
- {
- /* Turn off the speaker for awhile */
- outportb(0x61, bits & 0xfc);
- for (j = 0; j <= 100; j++)
- ; /* empty statement */
-
- /* Now turn it on for some more time */
- outportb(0x61, bits | 2);
- for (j = 0; j <= 100; j++)
- ; /* another empty statement */
- }
-
- /* Restore the control port setting */
- outportb(0x61, originalbits);
- }
-
-
- void main( void )
- {
- void interrupt (*old_handler)(...);
-
- old_handler = getvect( 10 );
- _AH = (unsigned)3;
- setvect( 10 , mybeep );
- geninterrupt( 10 );
- getch();
- setvect( 10 , old_handler );
- }
-
- _____________________________________________
-
-
- E-mail addr.: yinchau@pl.jaring.my
-
-